const path = require('path')
const webpack = require('webpack')

function resolve(dir) {
    return path.join(__dirname, dir)
}

const isProd = process.env.NODE_ENV === 'production'

// vue.config.js
const vueConfig = {
    // publicPath: '../static/tmallNumber/',
    publicPath: './',
    runtimeCompiler: true,
    devServer: {
        // cors: true,
        // development server port 8000
        port: 8000,
        // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
        proxy: {
            '/api': {
                target: 'http://localhost:8081/',
                ws: false,
                changeOrigin: true,
                pathRewrite: path => path.replace(/^\/api/, '')
            }
        }
    },

    // disable source map in production
    productionSourceMap: false,
    chainWebpack: config => {
        // 图片缩略限制
        config.module
          .rule('images')
          .use('url-loader')
          .loader('url-loader')
          .tap(options => Object.assign(options, { limit: 25*1024 }))
      }
    
}


module.exports = vueConfig
